package cn.xxi.ai.application.dto;

import cn.xxi.ai.application.constant.ChatModel;
import cn.xxi.ai.application.entity.AgentConfig;
import cn.xxi.ai.application.entity.Tool;
import cn.xxi.ai.knowledge.entity.Knowledge;
import cn.xxi.ai.workflow.entity.Workflow;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class OverrideAgentConfig {

    /** 预提示 */
    private String prePrompt;

    /** 聊天模型 */
    private ChatModel chatModel;

    /** 记忆 */
    private Boolean memory;

    /** 开场白开关 */
    private Boolean opening;

    /** 开场白 */
    private String openingRemark;

    /** 开场问题 */
    private List<String> openingQuestions;

    /** 知识库 ID */
    private List<Long> knowledgeIds;

    /** 工作流 ID */
    private List<Long> workflowIds;

    /** 工具 */
    private List<Tool> tools;

    /** 转换为实体类 */
    public AgentConfig toEntity(List<Knowledge> knowledgeList, List<Workflow> workflowList) {
        AgentConfig entity = new AgentConfig();
        entity.setPrePrompt(this.prePrompt);
        entity.setChatModel(this.chatModel);
        entity.setMemory(this.memory);
        entity.setOpening(this.opening);
        entity.setOpeningRemark(this.openingRemark);
        entity.setOpeningQuestions(this.openingQuestions);
        entity.setKnowledge(knowledgeList);
        entity.setWorkflows(workflowList);
        entity.setTools(this.tools);
        return entity;
    }
}